
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Probability.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Probability)
{
	TEST(should be able to calculate the probability of A does not occur: (1-0.3)=0.7)
	{
		Probability eventA(0.3);
		ASSERT_EQ(0.7, ~eventA);
	}
	TEST(should be able to calculate the probability of A and B both occur: (0.3*0.4)=0.12)
	{
		Probability eventA(0.3);
		Probability eventB(0.4);

		ASSERT_EQ(0.12, eventA & eventB);
	}
	TEST(should be able to calculate the probability of A or B occur: (0.3+0.4-0.3*0.4)=0.58)
	{
		Probability eventA(0.3);
		Probability eventB(0.4);

		ASSERT_EQ(0.58, eventA | eventB);
	}
};


